<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>
            视频管理
        </h2>
    </div>

    <div class="clearfix row with-padding">
        <div class="col-xs-10">
            <!--<a class="btn" href="{:U('add',array('pid'=>I('get.pid',0)))}">新 增</a>-->
            <!--<button class="btn ajax-post confirm" url="{:U('del')}" target-form="ids">删 除</button>-->
            <!--<a class="btn" href="{:U('import',array('pid'=>I('get.pid',0)))}">导 入</a>-->
        </div>
        <!-- 高级搜索 -->
        <div class="col-xs-2">
            <div class="search-form fr cf">
                <div class="sleft">
                    <div class="input-group">
                        <input type="text" name="title" class="form-control" value="{:I('title')}"
                               placeholder="请输入标题名称">
                               <span class="input-group-btn">
                    <a class="btn btn-default" href="javascript:;" id="search" url="__SELF__"><i
                            class="icon-search"></i></a></span>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="with-padding">

        <form class="ids">
            <table class="table table-bordered table-striped table-hover">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>标题名称</th>
                    <th width="20%">视频地址</th>
                    <th width="35%">说明</th>
                    <th width="12%">创建时间</th>
                    <th width="10%">操作</th>
                </tr>
                </thead>
                <tbody>
                <notempty name="list">
                    <volist name="list" id="vo">
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.title}</td>
                            <td><a href="{$vo.swf}" target="_blank">{$vo.swf}</a> </td>
                            <td>{$vo.remark}</td>
                            <td>{$vo.add_time}</td>
                            <td>
                                <a href="{:U('edit',array('id'=>$vo['id']))}">编辑</a>
                                <a href="javascript:;" onclick="del({$vo.id})">删除</a>
                            </td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="10" class="text-center"> aOh! 暂时还没有内容!</td>
                </notempty>
                </tbody>
            </table>
        </form>
        <!-- 分页 -->
        <div class="page">
{$page}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function () {
            //搜索功能
            $("#search").click(function () {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function (e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
            //导航高亮

            //点击排序
            $('.list_sort').click(function () {
                var url = $(this).attr('url');
                var ids = $('.ids:checked');
                var param = '';
                if (ids.length > 0) {
                    var str = new Array();
                    ids.each(function () {
                        str.push($(this).val());
                    });
                    param = str.join(',');
                }

                if (url != undefined && url != '') {
                    window.location.href = url + '/ids/' + param;
                }
            });
        });
        function del(id){
            if(confirm('确定删除该条数据')){
                location.href='{:U("del")}?id='+id;
            }
        }
    </script>
</block>